package com.gem.day12.homework;

import java.util.HashMap;
import java.util.Map;

public class Exercise3 {

	public static void main(String[] args) {
		String str = "To accurately say that your family and friends don't care about you would be a very rare situation.Maybe you're being too negative and overlooking the gestures of love they show you.They don't even have to be big gestures,but it's the little things they do for you that count.";
		String[] words = str.split(" ");
		Map<String, Integer> map = new HashMap<>();
		for (int i = 0; i < words.length; i++) {
			if (map.containsKey(words[i])) {
				int count = map.get(words[i]);
				count++;
				map.put(words[i], count);
			} else {
				map.put(words[i], 1);
			}
		}
		for (String s : map.keySet()) {
			System.out.println(s + "---->" + map.get(s));
		}
	}
}
